//该文件专门用于创建整个应用的路由
import VueRouter from "vue-router";






//创建并暴露一个路由器

export default new VueRouter({
    routes: [
        {
            path:'/',
            component:()=>import('@/layout'),
            redirect:'index',
            children:[
                {
                    path:'/index',
                    component:()=>import('@/views/home'),
                    name:'Index'
                },
                {
                    path:'/message',
                    name:'Message'
                },
                {
                    path:'/communitySquare',
                    component:()=>import('@/views/CommunitySquare'),
                    name:'CommunitySquare'
                },
                {
                    path:'/community',
                    component:()=>import('@/views/Community'),
                    name:'Community'
                },
                {
                    path:'/post/edit',
                    component:()=>import('@/views/PostEdit'),
                    name:'PostEdit'
                },
                {
                    path:'/post/update',
                    component:()=>import('@/views/PostUpdate'),
                    name:'PostUpdate'
                },
                {
                    path:'/post/detail',
                    component:()=>import('@/views/PostDetail'),
                    name:'PostDetail'
                },
                {
                    name: 'center',
                    path: '/center',
                    component: ()=>import('@/views/PersonalCenter'),
                    meta: {
                        title: "个人中心"
                    },
                    children: [
                        {
                            name: 'personalInfo',
                            path: 'personalInfo',
                            component: ()=>import('@/views/PersonalCenter/PersonnalDetails'),
                            meta: {
                                title: "个人信息"
                            }
                        },
                        {
                            name:'CollectList',
                            path:'collection',
                            component:()=>import("@/views/PersonalCenter/CollectionList"),
                            meta:{
                                title:"收藏列表"
                            }
                        },
                        {
                            name:'MyPostList',
                            path:'myPost',
                            component:()=>import("@/views/PersonalCenter/MyPostList"),
                            meta:{
                                title:"帖子列表"
                            }
                        }
                    ],
                    // redirect: '/center/personalInfo'
                },
            ]
        },
        {
            path:'/login',
            component:()=>import('@/views/login'),
            name:'Login'
        }
        
    ]

})